package com.szy.bigevent.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Map;

//@ConfigurationProperties(prefix = "ali-oss")
@Data
@Configuration
public class AliOssConfig {
    //url
    @Value("${ali-oss.endPointUrl}")
    private String endPointUrl;
    @Value("${ali-oss.endPoint}")
    private String endPoint;
    //存储空间名称
    @Value("${ali-oss.bucketName}")
    private String bucketName;
    @Value("${ACCESS_KEY_ID}")
    private String accessKeyId /*= System.getenv("accessKeyId")*/;
    @Value("${SECRET_ACCESS_KEY}")
    private String secretAccessKey/* = System.getenv("secretAccessKey")*/;


    @Bean
    public OSS getOSSClient() {
        return new OSSClientBuilder().build(endPointUrl, accessKeyId, secretAccessKey);
    }
}
